package com.ruoyi.common.my;

/**
 * Created by wyhao on 2022/12/15.
 */
public class MyRedis {

    private static final String PREFIX = "mr.";


    //MrMonitorPoint: pointCode --> pointId
    public static String makePointKey(String pointCode){
        return PREFIX + "point." + pointCode;
    }



    //MrMonitorCompanyPoint: id --> comId+pointId
    public static String makeCompanyPointMappingKey(long id){
        return PREFIX + "compoint." + id;
    }
    //MrMonitorCompanyPoint: comId+pointId --> MrMonitorCompanyPoint
    public static String makeCompanyPointKey(long comId, long pointId){
        return PREFIX + "compoint." + comId + "." + pointId;
    }


    //MrMonitorDevicePoint: id --> deviceId+pointId
    public static String makeDevicePointMappingKey(long id){
        return PREFIX + "devpoint." + id;
    }
    //MrMonitorDevicePoint: deviceId+pointId --> MrMonitorDevicePoint
    public static String makeDevicePointKey(long deviceId, long pointId){
        return PREFIX + "devpoint." + deviceId + "." + pointId;
    }


    //MrDevice: deviceId --> devId=boxCode
    public static String makeDeviceMappingKey(long deviceId){
        return PREFIX + "dev." + deviceId + ".box";
    }
    //MrDevice: devId=boxCode --> MrDevice
    public static String makeDeviceKey(String devId){
        return PREFIX + "box." + devId;
    }


    //设备监控项最近一次异常时间点
    //deviceId+pointId ---> Date
    public static String makeDevicePointErrorLastTimeKey(long deviceId, long pointId){
        return PREFIX + "deverror." + deviceId + "." + pointId;
    }

    //设备监控项最近一次报警报警点
    //deviceId+pointId ---> Date
    public static String makeDevicePointAlertLastTimeKey(long deviceId, long pointId){
        return PREFIX + "devalert." + deviceId + "." + pointId;
    }

}
